package A01;


import java.util.Scanner;

//插入回文字符串，使得插入后依然为回文字符串，输出符合条件的情况
public class D05 {

    public static void main (String[] args) {
        Scanner scan=new Scanner (System.in);
        String A=scan.next ();

        String B=scan.next ();

        int length=A.length ();

        int num=0;

        //插入到所有位置，所以此处是 i <= length
        for (int i = 0; i <= length; i++) {
            if(isback(construct(A,B,i))) num++;
        }

        System.out.println ("符合条件的输出结果是："+num);


    }

    //构建出新的字符串
    private static String construct(String A,String B,int o){
        StringBuilder result=new StringBuilder (A);

        result.insert (o,B);
        return result.toString ();
    }


    //判断是否为回文字符串
    private static boolean isback(String s){
        int len=s.length ();
        for (int i = 0; i < len/2; i++) {
            if(s.charAt (i)!=s.charAt (len-1-i))
                return false;
        }
        return true;
    }
}